package CuratorCtrl;

public class rule {
	private String name;
	private int guest_port;
	private int host_port;

	public rule(String input) {
		String[] split = input.split(",");
		int str = 0;
		str = split[0].indexOf("name = ") + 7;
		this.name = split[0].substring(str);
		str = split[3].indexOf("=") + 2;
		this.host_port = Integer.parseInt(split[3].substring(str));

		str = split[5].indexOf("=") + 2;
		this.guest_port = Integer.parseInt(split[5].substring(str));
	}

	public String display() {
		return this.name + " is from " + this.guest_port + " to "
				+ this.host_port;

	}

	public int getHost() {
		return this.host_port;
	}

	public String getName(){return this.name;}
	
	
	public int getGuest() {
		return this.guest_port;

	}
}
